//
//  BZYDistrictController.m
//  BZYMeituan
//
//  Created by 毕仲阳 on 16/9/16.
//  Copyright © 2016年 mycompany. All rights reserved.
//

#import "BZYDistrictController.h"
#import "BZYDropDownView.h"
#import "BZYCityController.h"
#import "BZYNavigatonController.h"
@interface BZYDistrictController ()

@end

@implementation BZYDistrictController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    BZYDropDownView *dropView = [BZYDropDownView dropDownView];
    [self.view addSubview:dropView];
    
    [self.view layoutIfNeeded];
    UIView *navView = self.view.subviews[0];
    dropView.y = navView.bounds.size.height;
    
    CGFloat height = CGRectGetMaxY(dropView.frame);
    self.preferredContentSize = CGSizeMake(dropView.size.width, height);
    dropView.districtArray = self.districtArray;
}
- (IBAction)switchCityButtonClick:(id)sender {
    //NSLog(@"switchCityButtonClick");
    [self dismissViewControllerAnimated:true completion:nil];
    BZYCityController *cityVc = [[BZYCityController alloc]init];
    
    BZYNavigatonController *nav = [[BZYNavigatonController alloc]initWithRootViewController:cityVc];
    
    //cityVc.modalPresentationStyle = UIModalPresentationFormSheet;
    nav.modalPresentationStyle = UIModalPresentationFormSheet;
    nav.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
    
    [[UIApplication sharedApplication].keyWindow.rootViewController presentViewController:nav animated:true completion:nil];
    //[self presentViewController:nav animated:true completion:nil];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
